#include <iostream>

using namespace std;
typedef long long LL;
LL exgcd(LL a, LL b, LL& x, LL& y)
{
	if (b == 0)
	{
		x = 1, y = 0;
		return a;
	}
	LL x1, y1, d;
	d = exgcd(b, a % b, x1, y1);
	x = y1, y = x1 - a / b * y1;
	return d;
}
int main()
{
	LL x, y, m, n, l; cin >> x >> y >> m >> n >> l;
	LL k, t, d;
	LL a = m - n;
	LL b = l;
	LL c = y - x;
	bool flag = false;
	if (a < 0)
	{
		a = -a;
		c = -c;
	}
	
	d = exgcd(a, b, k, t);
	if (c % d) cout << "Impossible" << endl;
	else
	{
		LL tmp = b / d;
		k = c / d * k;
		k = (k % tmp + tmp) % tmp;
		cout << k << endl;
	}
	return 0;
}